package com.yootk.server;
import java.net.*;

public class UDPServer {
    public static void main(String[] args) throws Exception {
        DatagramSocket server = new DatagramSocket(8000);  // 绑定到8000端口
        String message = "www.yootk.com";

        // 创建数据包，指定目标地址和端口
        DatagramPacket packet = new DatagramPacket(
                message.getBytes(), 0, message.length(),
                InetAddress.getByName("localhost"), 9999);

        server.send(packet);  // 发送数据
        System.out.println("【UDPServer】数据信息发送完毕 ......");
        server.close();
    }
}